home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Tool Chest / Text / WASTE / WASTE 1.1.2 Distribution / Pseudo-UPI for THINK Pascal / AppleEvents.p < prev    next >
Encoding:
Text File  |  1995-10-12  |  26.9 KB  |  756 lines  |  [TEXT/PJMM]

  1. unit AppleEvents;
  2.  
  3. { Pascal Interface to the Macintosh Libraries }
  4.  
  5. { Copyright © Apple Computer Inc. }
  6. { All Rights Reserved }
  7.  
  8. { Adapted for use with THINK Pascal 4.0.x by Marco Piovanelli }
  9.  
  10. interface
  11.     uses
  12.         Types, Notification;
  13.  
  14.     const
  15.  
  16. { gestalt constants (!!! transplanted from GestaltEqu.p !!!) }
  17.  
  18.         gestaltAppleEventsAttr = 'evnt';            { Apple Events attributes }
  19.         gestaltAppleEventsPresent = 0;            { True if Apple Events present }
  20.         gestaltScriptingSupport = 1;
  21.         gestaltOSLInSystem = 2;                        { OSL is in system so don’t use the one linked in to app }
  22.  
  23. { Apple event Manager error codes (!!! transplanted from Errors.p !!!) }
  24.  
  25.         errAECoercionFail = -1700;                        { bad parameter data or unable to coerce the data supplied }
  26.         errAEDescNotFound = -1701;
  27.         errAECorruptData = -1702;
  28.         errAEWrongDataType = -1703;
  29.         errAENotAEDesc = -1704;
  30.         errAEBadListItem = -1705;                        { the specified list item does not exist }
  31.         errAENewerVersion = -1706;                        { need newer version of the AppleEvent manager }
  32.         errAENotAppleEvent = -1707;                        { the event is not in AppleEvent format }
  33.         errAEEventNotHandled = -1708;                        { the AppleEvent was not handled by any handler }
  34.         errAEReplyNotValid = -1709;                        { AEResetTimer was passed an invalid reply parameter }
  35.         errAEUnknownSendMode = -1710;                        { mode wasn't NoReply, WaitReply, or QueueReply or Interaction level is unknown }
  36.         errAEWaitCanceled = -1711;                        { in AESend, the user cancelled out of wait loop for reply or receipt }
  37.         errAETimeout = -1712;                        { the AppleEvent timed out }
  38.         errAENoUserInteraction = -1713;                        { no user interaction is allowed }
  39.         errAENotASpecialFunction = -1714;                        { there is no special function for/with this keyword }
  40.         errAEParamMissed = -1715;                        { a required parameter was not accessed }
  41.         errAEUnknownAddressType = -1716;                        { the target address type is not known }
  42.         errAEHandlerNotFound = -1717;                        { no handler in the dispatch tables fits the parameters to AEGetEventHandler or AEGetCoercionHandler }
  43.         errAEReplyNotArrived = -1718;                        { the contents of the reply you are accessing have not arrived yet }
  44.         errAEIllegalIndex = -1719;                        { index is out of range in a put operation }
  45.         errAEUnknownObjectType = -1731;                        { available only in version 1.0.1 or greater }
  46.         errAERecordingIsAlreadyOn = -1732;                        { available only in version 1.0.1 or greater }
  47.  
  48. { Apple event descriptor types }
  49.         typeBoolean = 'bool';
  50.         typeChar = 'TEXT';
  51.         typeSMInt = 'shor';
  52.         typeInteger = 'long';
  53.         typeSMFloat = 'sing';
  54.         typeFloat = 'doub';
  55.         typeLongInteger = 'long';
  56.         typeShortInteger = 'shor';
  57.         typeLongFloat = 'doub';
  58.         typeShortFloat = 'sing';
  59.         typeExtended = 'exte';
  60.         typeComp = 'comp';
  61.         typeMagnitude = 'magn';
  62.         typeAEList = 'list';
  63.         typeAERecord = 'reco';
  64.         typeAppleEvent = 'aevt';
  65.         typeTrue = 'true';
  66.         typeFalse = 'fals';
  67.         typeAlias = 'alis';
  68.         typeEnumerated = 'enum';
  69.         typeType = 'type';
  70.         typeAppParameters = 'appa';
  71.         typeProperty = 'prop';
  72.         typeFSS = 'fss ';
  73.         typeKeyword = 'keyw';
  74.         typeSectionH = 'sect';
  75.         typeWildCard = '****';
  76.         typeApplSignature = 'sign';
  77.         typeQDRectangle = 'qdrt';
  78.         typeFixed = 'fixd';
  79.         typeSessionID = 'ssid';
  80.         typeTargetID = 'targ';
  81.         typeProcessSerialNumber = 'psn ';
  82.         typeNull = 'null';                        { null or nonexistent data }
  83. { Keywords for Apple event parameters }
  84.         keyDirectObject = '----';
  85.         keyErrorNumber = 'errn';
  86.         keyErrorString = 'errs';
  87.         keyProcessSerialNumber = 'psn ';
  88. { Keywords for Apple event attributes }
  89.         keyTransactionIDAttr = 'tran';
  90.         keyReturnIDAttr = 'rtid';
  91.         keyEventClassAttr = 'evcl';
  92.         keyEventIDAttr = 'evid';
  93.         keyAddressAttr = 'addr';
  94.         keyOptionalKeywordAttr = 'optk';
  95.         keyTimeoutAttr = 'timo';
  96.         keyInteractLevelAttr = 'inte';                        { this attribute is read only - will be set in AESend }
  97.         keyEventSourceAttr = 'esrc';                        { this attribute is read only }
  98.         keyMissedKeywordAttr = 'miss';                        { this attribute is read only }
  99.         keyOriginalAddressAttr = 'from';                        { new in 1.0.1 }
  100. { Keywords for special handlers }
  101.         keyPreDispatch = 'phac';                        { preHandler accessor call }
  102.         keySelectProc = 'selh';                        { more selector call }
  103. { Keyword for recording }
  104.         keyAERecorderCount = 'recr';                        { available only in vers 1.0.1 and greater }
  105. { Keyword for version information }
  106.         keyAEVersion = 'vers';                        { available only in vers 1.0.1 and greater }
  107. { Event Class }
  108.         kCoreEventClass = 'aevt';
  109. { Event ID’s }
  110.         kAEOpenApplication = 'oapp';
  111.         kAEOpenDocuments = 'odoc';
  112.         kAEPrintDocuments = 'pdoc';
  113.         kAEQuitApplication = 'quit';
  114.         kAEAnswer = 'ansr';
  115.         kAEApplicationDied = 'obit';
  116.  
  117. { Constants for use in AESend mode }
  118.         kAENoReply = $00000001;                    { sender doesn't want a reply to event }
  119.         kAEQueueReply = $00000002;                    { sender wants a reply but won't wait }
  120.         kAEWaitReply = $00000003;                    { sender wants a reply and will wait }
  121.         kAENeverInteract = $00000010;                    { server should not interact with user }
  122.         kAECanInteract = $00000020;                    { server may try to interact with user }
  123.         kAEAlwaysInteract = $00000030;                    { server should always interact with user where appropriate }
  124.         kAECanSwitchLayer = $00000040;                    { interaction may switch layer }
  125.         kAEDontReconnect = $00000080;                    { don't reconnect if there is a sessClosedErr from PPCToolbox }
  126.         kAEWantReceipt = $00000200;                { sender wants a receipt of message }
  127.         kAEDontRecord = $00001000;                    { don't record this event - available only in vers 1.0.1 and greater }
  128.         kAEDontExecute = $00002000;                    { don't send the event for recording - available only in vers 1.0.1 and greater }
  129. { Constants for the send priority in AESend }
  130.         kAENormalPriority = $00000000;                    { post message at the end of the event queue }
  131.         kAEHighPriority = $00000001;                        { post message at the front of the event queue }
  132.  
  133. { Constants for recording }
  134.         kAEStartRecording = 'reca';                        { available only in vers 1.0.1 and greater }
  135.         kAEStopRecording = 'recc';                        { available only in vers 1.0.1 and greater }
  136.         kAENotifyStartRecording = 'rec1';                        { available only in vers 1.0.1 and greater }
  137.         kAENotifyStopRecording = 'rec0';                        { available only in vers 1.0.1 and greater }
  138.         kAENotifyRecording = 'recr';
  139.  
  140. { Constant for the returnID param of AECreateAppleEvent }
  141.         kAutoGenerateReturnID = -1;                            { AECreateAppleEvent will generate a session-unique ID }
  142. { Constant for transaction ID’s }
  143.         kAnyTransactionID = 0;                            { no transaction is in use }
  144. { Constants for timeout durations }
  145.         kAEDefaultTimeout = -1;                            { timeout value determined by AEM }
  146.         kNoTimeOut = -2;                            { wait until reply comes back, however long it takes }
  147.  
  148. { Constants for AEResumeTheCurrentEvent }
  149.         kAENoDispatch = 0;                            { dispatch parameter to AEResumeTheCurrentEvent takes a pointer to a dispatch }
  150.         kAEUseStandardDispatch = $FFFFFFFF;                    { table, or one of these two constants }
  151. { Constants for Refcon in AEResumeTheCurrentEvent with kAEUseStandardDispatch }
  152.         kAEDoNotIgnoreHandler = $00000000;
  153.         kAEIgnoreAppPhacHandler = $00000001;                    { available only in vers 1.0.1 and greater }
  154.         kAEIgnoreAppEventHandler = $00000002;                    { available only in vers 1.0.1 and greater }
  155.         kAEIgnoreSysPhacHandler = $00000004;                    { available only in vers 1.0.1 and greater }
  156.         kAEIgnoreSysEventHandler = $00000008;                    { available only in vers 1.0.1 and greater }
  157.         kAEIngoreBuiltInEventHandler = $00000010;                    { available only in vers 1.0.1 and greater }
  158.         kAEDontDisposeOnResume = $80000000;                    { available only in vers 1.0.1 and greater }
  159.  
  160. { Apple event manager data types }
  161.  
  162.     type
  163.         AEEventClass = FourCharCode;
  164.  
  165.         AEEventID = FourCharCode;
  166.  
  167.         AEKeyword = FourCharCode;
  168.  
  169.         DescType = ResType;
  170.  
  171.         AEDesc = record
  172.                 descriptorType: DescType;
  173.                 dataHandle: Handle;
  174.             end;
  175.         AEKeyDesc = record
  176.                 descKey: AEKeyword;
  177.                 descContent: AEDesc;
  178.             end;
  179. { an AEDesc which contains address data }
  180.         AEAddressDesc = AEDesc;
  181.  
  182. { a list of AEDesc's is a special kind of AEDesc }
  183.         AEDescList = AEDesc;
  184.  
  185. { AERecord is a list of keyworded AEDesc's }
  186.         AERecord = AEDescList;
  187.  
  188. { an AERecord that contains an AppleEvent }
  189.         AppleEvent = AERecord;
  190.  
  191. { parameter to AESend }
  192.         AESendMode = LONGINT;
  193.  
  194. { priority param of AESend }
  195.         AESendPriority = INTEGER;
  196.  
  197.  
  198.     const
  199.         kAEInteractWithSelf = 0;
  200.         kAEInteractWithLocal = 1;
  201.         kAEInteractWithAll = 2;
  202.  
  203.  
  204.     type
  205.         AEInteractAllowed = SInt8;
  206.  
  207.  
  208.     const
  209.         kAEUnknownSource = 0;
  210.         kAEDirectCall = 1;
  211.         kAESameProcess = 2;
  212.         kAELocalProcess = 3;
  213.         kAERemoteProcess = 4;
  214.  
  215.  
  216.     type
  217.         AEEventSource = SInt8;
  218.  
  219.  
  220.     const
  221.         kAEDataArray = 0;
  222.         kAEPackedArray = 1;
  223.         kAEHandleArray = 2;
  224.         kAEDescArray = 3;
  225.         kAEKeyDescArray = 4;
  226.  
  227.  
  228.     type
  229.         AEArrayType = SInt8;
  230.  
  231.         AEArrayData = record
  232.                 case INTEGER of
  233.                     0: (
  234.                             kAEDataArray: array[0..0] of INTEGER;
  235.                     );
  236.                     1: (
  237.                             kAEPackedArray: packed array[0..0] of CHAR;
  238.                     );
  239.                     2: (
  240.                             kAEHandleArray: array[0..0] of Handle;
  241.                     );
  242.                     3: (
  243.                             kAEDescArray: array[0..0] of AEDesc;
  244.                     );
  245.                     4: (
  246.                             kAEKeyDescArray: array[0..0] of AEKeyDesc;
  247.                     );
  248.             end;
  249.         AEArrayDataPointer = ^AEArrayData;
  250.  
  251.         AEIdleProcPtr = ProcPtr;  { FUNCTION AEIdle(VAR theEvent: EventRecord; VAR sleepTime: LONGINT; VAR mouseRgn: RgnHandle): BOOLEAN; }
  252.         AEIdleUPP = UniversalProcPtr;
  253.  
  254.     const
  255.         uppAEIdleProcInfo = $00000FD0; { FUNCTION (4 byte param, 4 byte param, 4 byte param): 1 byte result; }
  256.  
  257.     function NewAEIdleProc (userRoutine: AEIdleProcPtr): AEIdleUPP;
  258.     inline
  259.         $2E9F;
  260.  
  261.     function CallAEIdleProc (var theEvent: EventRecord;
  262.                                     var sleepTime: LONGINT;
  263.                                     var mouseRgn: RgnHandle;
  264.                                     userRoutine: AEIdleUPP): BOOLEAN;
  265.     inline
  266.         $205F, $4E90;
  267.     type
  268.         AEFilterProcPtr = ProcPtr;  { FUNCTION AEFilter(VAR theEvent: EventRecord; returnID: LONGINT; transactionID: LONGINT; (CONST)VAR sender: AEAddressDesc): BOOLEAN; }
  269.         AEFilterUPP = UniversalProcPtr;
  270.  
  271.     const
  272.         uppAEFilterProcInfo = $00003FD0; { FUNCTION (4 byte param, 4 byte param, 4 byte param, 4 byte param): 1 byte result; }
  273.  
  274.     function NewAEFilterProc (userRoutine: AEFilterProcPtr): AEFilterUPP;
  275.     inline
  276.         $2E9F;
  277.  
  278.     function CallAEFilterProc (var theEvent: EventRecord;
  279.                                     returnID: LONGINT;
  280.                                     transactionID: LONGINT; {CONST}
  281.                                     var sender: AEAddressDesc;
  282.                                     userRoutine: AEFilterUPP): BOOLEAN;
  283.     inline
  284.         $205F, $4E90;
  285.     type
  286.         AEEventHandlerProcPtr = ProcPtr;  { FUNCTION AEEventHandler((CONST)VAR theAppleEvent: AppleEvent; VAR reply: AppleEvent; handlerRefcon: LONGINT): OSErr; }
  287.         AEEventHandlerUPP = UniversalProcPtr;
  288.  
  289.     const
  290.         uppAEEventHandlerProcInfo = $00000FE0; { FUNCTION (4 byte param, 4 byte param, 4 byte param): 2 byte result; }
  291.  
  292.     function NewAEEventHandlerProc (userRoutine: AEEventHandlerProcPtr): AEEventHandlerUPP;
  293.     inline
  294.         $2E9F;
  295.  
  296.     function CallAEEventHandlerProc ({CONST}
  297.                                     var theAppleEvent: AppleEvent;
  298.                                     var reply: AppleEvent;
  299.                                     handlerRefcon: LONGINT;
  300.                                     userRoutine: AEEventHandlerUPP): OSErr;
  301.     inline
  302.         $205F, $4E90;
  303.     type
  304.         AECoerceDescProcPtr = ProcPtr;  { FUNCTION AECoerceDesc((CONST)VAR fromDesc: AEDesc; toType: DescType; handlerRefcon: LONGINT; VAR toDesc: AEDesc): OSErr; }
  305.         AECoerceDescUPP = UniversalProcPtr;
  306.  
  307.     const
  308.         uppAECoerceDescProcInfo = $00003FE0; { FUNCTION (4 byte param, 4 byte param, 4 byte param, 4 byte param): 2 byte result; }
  309.  
  310.     function NewAECoerceDescProc (userRoutine: AECoerceDescProcPtr): AECoerceDescUPP;
  311.     inline
  312.         $2E9F;
  313.  
  314.     function CallAECoerceDescProc ({CONST}
  315.                                     var fromDesc: AEDesc;
  316.                                     toType: DescType;
  317.                                     handlerRefcon: LONGINT;
  318.                                     var toDesc: AEDesc;
  319.                                     userRoutine: AECoerceDescUPP): OSErr;
  320.     inline
  321.         $205F, $4E90;
  322.     type
  323.         AECoercePtrProcPtr = ProcPtr;  { FUNCTION AECoercePtr(typeCode: DescType; dataPtr: UNIV Ptr; dataSize: Size; toType: DescType; handlerRefcon: LONGINT; VAR result: AEDesc): OSErr; }
  324.         AECoercePtrUPP = UniversalProcPtr;
  325.  
  326.     const
  327.         uppAECoercePtrProcInfo = $0003FFE0; { FUNCTION (4 byte param, 4 byte param, 4 byte param, 4 byte param, 4 byte param, 4 byte param): 2 byte result; }
  328.  
  329.     function NewAECoercePtrProc (userRoutine: AECoercePtrProcPtr): AECoercePtrUPP;
  330.     inline
  331.         $2E9F;
  332.  
  333.     function CallAECoercePtrProc (typeCode: DescType;
  334.                                     dataPtr: univ Ptr;
  335.                                     dataSize: Size;
  336.                                     toType: DescType;
  337.                                     handlerRefcon: LONGINT;
  338.                                     var result: AEDesc;
  339.                                     userRoutine: AECoercePtrUPP): OSErr;
  340.     inline
  341.         $205F, $4E90;
  342.  
  343.     type
  344.         AECoercionHandlerUPP = UniversalProcPtr;
  345.  
  346. {*************************************************************************}
  347. { The following calls apply to any AEDesc. Every 'result' descriptor is}
  348. { created for you, so you will be responsible for memory management}
  349. { (including disposing) of the descriptors so created. Note: purgeable}
  350. { descriptor data is not supported - the AEM does not call LoadResource.  }
  351. {*************************************************************************}
  352.  
  353.     function AECreateDesc (typeCode: DescType;
  354.                                     dataPtr: univ Ptr;
  355.                                     dataSize: Size;
  356.                                     var result: AEDesc): OSErr;
  357.     inline
  358.         $303C, $0825, $A816;
  359.     function AECoercePtr (typeCode: DescType;
  360.                                     dataPtr: univ Ptr;
  361.                                     dataSize: Size;
  362.                                     toType: DescType;
  363.                                     var result: AEDesc): OSErr;
  364.     inline
  365.         $303C, $0A02, $A816;
  366.     function AECoerceDesc ({CONST}
  367.                                     var theAEDesc: AEDesc;
  368.                                     toType: DescType;
  369.                                     var result: AEDesc): OSErr;
  370.     inline
  371.         $303C, $0603, $A816;
  372.     function AEDisposeDesc (var theAEDesc: AEDesc): OSErr;
  373.     inline
  374.         $303C, $0204, $A816;
  375.     function AEDuplicateDesc ({CONST}
  376.                                     var theAEDesc: AEDesc;
  377.                                     var result: AEDesc): OSErr;
  378.     inline
  379.         $303C, $0405, $A816;
  380. {*************************************************************************}
  381. {  The following calls apply to AEDescList. Since AEDescList is a subtype of}
  382. {  AEDesc, the calls in the previous section can also be used for AEDescList.}
  383. {  All list and array indices are 1-based. If the data was greater than}
  384. {  maximumSize in the routines below, then actualSize will be greater than}
  385. {  maximumSize, but only maximumSize bytes will actually be retrieved.}
  386. {*************************************************************************}
  387.     function AECreateList (factoringPtr: univ Ptr;
  388.                                     factoredSize: Size;
  389.                                     isRecord: BOOLEAN;
  390.                                     var resultList: AEDescList): OSErr;
  391.     inline
  392.         $303C, $0706, $A816;
  393.     function AECountItems ({CONST}
  394.                                     var theAEDescList: AEDescList;
  395.                                     var theCount: LONGINT): OSErr;
  396.     inline
  397.         $303C, $0407, $A816;
  398.     function AEPutPtr (var theAEDescList: AEDescList;
  399.                                     index: LONGINT;
  400.                                     typeCode: DescType;
  401.                                     dataPtr: univ Ptr;
  402.                                     dataSize: Size): OSErr;
  403.     inline
  404.         $303C, $0A08, $A816;
  405.     function AEPutDesc (var theAEDescList: AEDescList;
  406.                                     index: LONGINT; {CONST}
  407.                                     var theAEDesc: AEDesc): OSErr;
  408.     inline
  409.         $303C, $0609, $A816;
  410.     function AEGetNthPtr ({CONST}
  411.                                     var theAEDescList: AEDescList;
  412.                                     index: LONGINT;
  413.                                     desiredType: DescType;
  414.                                     var theAEKeyword: AEKeyword;
  415.                                     var typeCode: DescType;
  416.                                     dataPtr: univ Ptr;
  417.                                     maximumSize: Size;
  418.                                     var actualSize: Size): OSErr;
  419.     inline
  420.         $303C, $100A, $A816;
  421.     function AEGetNthDesc ({CONST}
  422.                                     var theAEDescList: AEDescList;
  423.                                     index: LONGINT;
  424.                                     desiredType: DescType;
  425.                                     var theAEKeyword: AEKeyword;
  426.                                     var result: AEDesc): OSErr;
  427.     inline
  428.         $303C, $0A0B, $A816;
  429.     function AESizeOfNthItem ({CONST}
  430.                                     var theAEDescList: AEDescList;
  431.                                     index: LONGINT;
  432.                                     var typeCode: DescType;
  433.                                     var dataSize: Size): OSErr;
  434.     inline
  435.         $303C, $082A, $A816;
  436.     function AEGetArray ({CONST}
  437.                                     var theAEDescList: AEDescList;
  438.                                     arrayType: ByteParameter;
  439.                                     arrayPtr: AEArrayDataPointer;
  440.                                     maximumSize: Size;
  441.                                     var itemType: DescType;
  442.                                     var itemSize: Size;
  443.                                     var itemCount: LONGINT): OSErr;
  444.     inline
  445.         $303C, $0D0C, $A816;
  446.     function AEPutArray (var theAEDescList: AEDescList;
  447.                                     arrayType: ByteParameter; {CONST}
  448.                                     var arrayPtr: AEArrayData;
  449.                                     itemType: DescType;
  450.                                     itemSize: Size;
  451.                                     itemCount: LONGINT): OSErr;
  452.     inline
  453.         $303C, $0B0D, $A816;
  454.     function AEDeleteItem (var theAEDescList: AEDescList;
  455.                                     index: LONGINT): OSErr;
  456.     inline
  457.         $303C, $040E, $A816;
  458. {*************************************************************************}
  459. { The following calls apply to AERecord. Since AERecord is a subtype of}
  460. { AEDescList, the calls in the previous sections can also be used for}
  461. { AERecord an AERecord can be created by using AECreateList with isRecord}
  462. { set to true. }
  463. {*************************************************************************}
  464.     function AEPutKeyPtr (var theAppleEvent: AppleEvent;
  465.                                     theAEKeyword: AEKeyword;
  466.                                     typeCode: DescType;
  467.                                     dataPtr: univ Ptr;
  468.                                     dataSize: Size): OSErr;
  469.     inline
  470.         $303C, $0A0F, $A816;
  471.     function AEPutKeyDesc (var theAppleEvent: AppleEvent;
  472.                                     theAEKeyword: AEKeyword; {CONST}
  473.                                     var theAEDesc: AEDesc): OSErr;
  474.     inline
  475.         $303C, $0610, $A816;
  476.     function AEGetKeyPtr ({CONST}
  477.                                     var theAppleEvent: AppleEvent;
  478.                                     theAEKeyword: AEKeyword;
  479.                                     desiredType: DescType;
  480.                                     var typeCode: DescType;
  481.                                     dataPtr: univ Ptr;
  482.                                     maximumSize: Size;
  483.                                     var actualSize: Size): OSErr;
  484.     inline
  485.         $303C, $0E11, $A816;
  486.     function AEGetKeyDesc ({CONST}
  487.                                     var theAppleEvent: AppleEvent;
  488.                                     theAEKeyword: AEKeyword;
  489.                                     desiredType: DescType;
  490.                                     var result: AEDesc): OSErr;
  491.     inline
  492.         $303C, $0812, $A816;
  493.     function AESizeOfKeyDesc ({CONST}
  494.                                     var theAppleEvent: AppleEvent;
  495.                                     theAEKeyword: AEKeyword;
  496.                                     var typeCode: DescType;
  497.                                     var dataSize: Size): OSErr;
  498.     inline
  499.         $303C, $0829, $A816;
  500.     function AEDeleteKeyDesc (var theAppleEvent: AppleEvent;
  501.                                     theAEKeyword: AEKeyword): OSErr;
  502.     inline
  503.         $303C, $0413, $A816;
  504.     function AEPutParamPtr (var theAppleEvent: AppleEvent;
  505.                                     theAEKeyword: AEKeyword;
  506.                                     typeCode: DescType;
  507.                                     dataPtr: univ Ptr;
  508.                                     dataSize: Size): OSErr;
  509.     inline
  510.         $303C, $0A0F, $A816;
  511.     function AEPutParamDesc (var theAppleEvent: AppleEvent;
  512.                                     theAEKeyword: AEKeyword; {CONST}
  513.                                     var theAEDesc: AEDesc): OSErr;
  514.     inline
  515.         $303C, $0610, $A816;
  516.     function AEGetParamPtr ({CONST}
  517.                                     var theAppleEvent: AppleEvent;
  518.                                     theAEKeyword: AEKeyword;
  519.                                     desiredType: DescType;
  520.                                     var typeCode: DescType;
  521.                                     dataPtr: univ Ptr;
  522.                                     maximumSize: Size;
  523.                                     var actualSize: Size): OSErr;
  524.     inline
  525.         $303C, $0E11, $A816;
  526.     function AEGetParamDesc ({CONST}
  527.                                     var theAppleEvent: AppleEvent;
  528.                                     theAEKeyword: AEKeyword;
  529.                                     desiredType: DescType;
  530.                                     var result: AEDesc): OSErr;
  531.     inline
  532.         $303C, $0812, $A816;
  533.     function AESizeOfParam ({CONST}
  534.                                     var theAppleEvent: AppleEvent;
  535.                                     theAEKeyword: AEKeyword;
  536.                                     var typeCode: DescType;
  537.                                     var dataSize: Size): OSErr;
  538.     inline
  539.         $303C, $0829, $A816;
  540.     function AEDeleteParam (var theAppleEvent: AppleEvent;
  541.                                     theAEKeyword: AEKeyword): OSErr;
  542.     inline
  543.         $303C, $0413, $A816;
  544. {*************************************************************************}
  545. { The following calls also apply to type AppleEvent. Message attributes are}
  546. { far more restricted, and can only be accessed through the following 5}
  547. { calls. The various list and record routines cannot be used to access the}
  548. { attributes of an event. }
  549. {*************************************************************************}
  550.     function AEGetAttributePtr ({CONST}
  551.                                     var theAppleEvent: AppleEvent;
  552.                                     theAEKeyword: AEKeyword;
  553.                                     desiredType: DescType;
  554.                                     var typeCode: DescType;
  555.                                     dataPtr: univ Ptr;
  556.                                     maximumSize: Size;
  557.                                     var actualSize: Size): OSErr;
  558.     inline
  559.         $303C, $0E15, $A816;
  560.     function AEGetAttributeDesc ({CONST}
  561.                                     var theAppleEvent: AppleEvent;
  562.                                     theAEKeyword: AEKeyword;
  563.                                     desiredType: DescType;
  564.                                     var result: AEDesc): OSErr;
  565.     inline
  566.         $303C, $0826, $A816;
  567.     function AESizeOfAttribute ({CONST}
  568.                                     var theAppleEvent: AppleEvent;
  569.                                     theAEKeyword: AEKeyword;
  570.                                     var typeCode: DescType;
  571.                                     var dataSize: Size): OSErr;
  572.     inline
  573.         $303C, $0828, $A816;
  574.     function AEPutAttributePtr (var theAppleEvent: AppleEvent;
  575.                                     theAEKeyword: AEKeyword;
  576.                                     typeCode: DescType;
  577.                                     dataPtr: univ Ptr;
  578.                                     dataSize: Size): OSErr;
  579.     inline
  580.         $303C, $0A16, $A816;
  581.     function AEPutAttributeDesc (var theAppleEvent: AppleEvent;
  582.                                     theAEKeyword: AEKeyword; {CONST}
  583.                                     var theAEDesc: AEDesc): OSErr;
  584.     inline
  585.         $303C, $0627, $A816;
  586. {*************************************************************************}
  587. {  The next couple of calls are basic routines used to create, send,}
  588. {  and process AppleEvents. }
  589. {*************************************************************************}
  590.     function AECreateAppleEvent (theAEEventClass: AEEventClass;
  591.                                     theAEEventID: AEEventID; {CONST}
  592.                                     var target: AEAddressDesc;
  593.                                     returnID: INTEGER;
  594.                                     transactionID: LONGINT;
  595.                                     var result: AppleEvent): OSErr;
  596.     inline
  597.         $303C, $0B14, $A816;
  598.     function AESend ({CONST}
  599.                                     var theAppleEvent: AppleEvent;
  600.                                     var reply: AppleEvent;
  601.                                     sendMode: AESendMode;
  602.                                     sendPriority: AESendPriority;
  603.                                     timeOutInTicks: LONGINT;
  604.                                     idleProc: AEIdleUPP;
  605.                                     filterProc: AEFilterUPP): OSErr;
  606.     inline
  607.         $303C, $0D17, $A816;
  608.     function AEProcessAppleEvent ({CONST}
  609.                                     var theEventRecord: EventRecord): OSErr;
  610.     inline
  611.         $303C, $021B, $A816;
  612. { }
  613. { Note: during event processing, an event handler may realize that it is likely}
  614. { to exceed the client's timeout limit. Passing the reply to this}
  615. { routine causes a wait event to be generated that asks the client}
  616. { for more time. }
  617. {}
  618.     function AEResetTimer ({CONST}
  619.                                     var reply: AppleEvent): OSErr;
  620.     inline
  621.         $303C, $0219, $A816;
  622. {*************************************************************************}
  623. { The following four calls are available for applications which need more}
  624. { sophisticated control over when and how events are processed. Applications}
  625. { which implement multi-session servers or which implement their own}
  626. { internal event queueing will probably be the major clients of these}
  627. { routines. They can be called from within a handler to prevent the AEM from}
  628. { disposing of the AppleEvent when the handler returns. They can be used to}
  629. { asynchronously process the event (as MacApp does).}
  630. {*************************************************************************}
  631.     function AESuspendTheCurrentEvent ({CONST}
  632.                                     var theAppleEvent: AppleEvent): OSErr;
  633.     inline
  634.         $303C, $022B, $A816;
  635. { }
  636. { Note: The following routine tells the AppleEvent manager that processing}
  637. { is either about to resume or has been completed on a previously suspended}
  638. { event. The procPtr passed in as the dispatcher parameter will be called to}
  639. { attempt to redispatch the event. Several constants for the dispatcher}
  640. { parameter allow special behavior. They are:}
  641. {      - kAEUseStandardDispatch means redispatch as if the event was just}
  642. {      received, using the standard AppleEvent dispatch mechanism.}
  643. {      - kAENoDispatch means ignore the parameter.}
  644. {         Use this in the case where the event has been handled and no}
  645. {      redispatch is needed.}
  646. {      - non nil means call the routine which the dispatcher points to.}
  647. {}
  648.     function AEResumeTheCurrentEvent ({CONST}
  649.                                     var theAppleEvent: AppleEvent; {CONST}
  650.                                     var reply: AppleEvent;
  651.                                     dispatcher: AEEventHandlerUPP;
  652.                                     handlerRefcon: LONGINT): OSErr;
  653.     inline
  654.         $303C, $0818, $A816;
  655.     function AEGetTheCurrentEvent (var theAppleEvent: AppleEvent): OSErr;
  656.     inline
  657.         $303C, $021A, $A816;
  658.     function AESetTheCurrentEvent ({CONST}
  659.                                     var theAppleEvent: AppleEvent): OSErr;
  660.     inline
  661.         $303C, $022C, $A816;
  662. {*************************************************************************}
  663. {  The following three calls are used to allow applications to behave}
  664. {  courteously when a user interaction such as a dialog box is needed. }
  665. {*************************************************************************}
  666.     function AEGetInteractionAllowed (var level: AEInteractAllowed): OSErr;
  667.     inline
  668.         $303C, $021D, $A816;
  669.     function AESetInteractionAllowed (level: ByteParameter): OSErr;
  670.     inline
  671.         $303C, $011E, $A816;
  672.     function AEInteractWithUser (timeOutInTicks: LONGINT;
  673.                                     nmReqPtr: NMRecPtr;
  674.                                     idleProc: AEIdleUPP): OSErr;
  675.     inline
  676.         $303C, $061C, $A816;
  677. {*************************************************************************}
  678. {  These calls are used to set up and modify the event dispatch table.}
  679. {*************************************************************************}
  680.     function AEInstallEventHandler (theAEEventClass: AEEventClass;
  681.                                     theAEEventID: AEEventID;
  682.                                     handler: AEEventHandlerUPP;
  683.                                     handlerRefcon: LONGINT;
  684.                                     isSysHandler: BOOLEAN): OSErr;
  685.     inline
  686.         $303C, $091F, $A816;
  687.     function AERemoveEventHandler (theAEEventClass: AEEventClass;
  688.                                     theAEEventID: AEEventID;
  689.                                     handler: AEEventHandlerUPP;
  690.                                     isSysHandler: BOOLEAN): OSErr;
  691.     inline
  692.         $303C, $0720, $A816;
  693.     function AEGetEventHandler (theAEEventClass: AEEventClass;
  694.                                     theAEEventID: AEEventID;
  695.                                     var handler: AEEventHandlerUPP;
  696.                                     var handlerRefcon: LONGINT;
  697.                                     isSysHandler: BOOLEAN): OSErr;
  698.     inline
  699.         $303C, $0921, $A816;
  700. {*************************************************************************}
  701. {  These calls are used to set up and modify the coercion dispatch table.}
  702. {*************************************************************************}
  703.     function AEInstallCoercionHandler (fromType: DescType;
  704.                                     toType: DescType;
  705.                                     handler: AECoercionHandlerUPP;
  706.                                     handlerRefcon: LONGINT;
  707.                                     fromTypeIsDesc: BOOLEAN;
  708.                                     isSysHandler: BOOLEAN): OSErr;
  709.     inline
  710.         $303C, $0A22, $A816;
  711.     function AERemoveCoercionHandler (fromType: DescType;
  712.                                     toType: DescType;
  713.                                     handler: AECoercionHandlerUPP;
  714.                                     isSysHandler: BOOLEAN): OSErr;
  715.     inline
  716.         $303C, $0723, $A816;
  717.     function AEGetCoercionHandler (fromType: DescType;
  718.                                     toType: DescType;
  719.                                     var handler: AECoercionHandlerUPP;
  720.                                     var handlerRefcon: LONGINT;
  721.                                     var fromTypeIsDesc: BOOLEAN;
  722.                                     isSysHandler: BOOLEAN): OSErr;
  723.     inline
  724.         $303C, $0B24, $A816;
  725. {*************************************************************************}
  726. {  These calls are used to set up and modify special hooks into the}
  727. {  AppleEvent manager.}
  728. {*************************************************************************}
  729.     function AEInstallSpecialHandler (functionClass: AEKeyword;
  730.                                     handler: UniversalProcPtr;
  731.                                     isSysHandler: BOOLEAN): OSErr;
  732.     inline
  733.         $303C, $0500, $A816;
  734.     function AERemoveSpecialHandler (functionClass: AEKeyword;
  735.                                     handler: UniversalProcPtr;
  736.                                     isSysHandler: BOOLEAN): OSErr;
  737.     inline
  738.         $303C, $0501, $A816;
  739.     function AEGetSpecialHandler (functionClass: AEKeyword;
  740.                                     var handler: UniversalProcPtr;
  741.                                     isSysHandler: BOOLEAN): OSErr;
  742.     inline
  743.         $303C, $052D, $A816;
  744. {*************************************************************************}
  745. {  This call was added in version 1.0.1. If called with the keyword}
  746. {  keyAERecorderCount ('recr'), the number of recorders that are}
  747. {  currently active is returned in 'result'.}
  748. {*************************************************************************}
  749. { available only in vers 1.0.1 and greater }
  750.     function AEManagerInfo (keyWord: AEKeyword;
  751.                                     var result: LONGINT): OSErr;
  752.     inline
  753.         $303C, $0441, $A816;
  754.  
  755. implementation
  756. end.